﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

// 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码、服务和配置文件中的类名“Service”。
public class Service : IService
{
	public string GetData(int value)
	{
		return string.Format("You entered: {0}", value);
	}
    
	public CompositeType GetDataUsingDataContract(CompositeType composite)
	{
		if (composite == null)
		{
			throw new ArgumentNullException("composite");
		}
		if (composite.BoolValue)
		{
			composite.StringValue += "Suffix";
		}
		return composite;
	}

    //[OperationContract]
    //[WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/Add", BodyStyle = WebMessageBodyStyle.WrappedRequest)]
    //public int Add(int x, int y)
    //{
    //    return x + y;
    //}
    //[OperationContract]
    //[WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/Speak", BodyStyle = WebMessageBodyStyle.WrappedRequest)]
    //public string Speak(People p)
    //{
    //    string sexCN = p.sex == 1 ? "男" : "女";
    //    return "我叫" + p.name + "," + sexCN + "性,出生于" + p.birth.ToString("yyyy-MM-dd");
    //}
}

//[DataContract]
//public class People
//{
//    [DataMember]
//    public string name;
//    [DataMember]
//    public byte sex;
//    [DataMember]
//    public DateTime birth;
//}